renv::init()
renv
#### Do Formal Loans Boost SME Performance? Key Takeaways from a Meta-Analysis ####
#### Main R Script #####
rm(list = ls()) # Remove all objects from the environment
options(scipen = 999)
# This line is to start the timer
start_time <- Sys.time() #Start time
# Load libraries ----
# Install the required packages
required_packages <- c("tidyverse", "meta", "readxl", "ggplot2", "tidyr", "writexl", "baggr", "stargazer","rstan","openxlsx","forestplot", "ggpubr","xtable")
# Install any package that is not already installed
for (pkg in required_packages) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg)
}
}
# Load the libraries
library(tidyverse)   # For data manipulation and visualization (includes dplyr, ggplot2, tidyr, etc.)
library(meta)        # For conducting meta-analyses
library(readxl)      # For reading Excel files (.xlsx)
library(ggplot2)     # For creating plots and visualizations
library(tidyr)       # For reshaping and tidying data
library(writexl)     # For writing data frames to Excel files (.xlsx)
library(baggr)       # For Bayesian meta-analysis
# 1. Remove baggr from the renv project/cache
renv::remove("baggr")
# 2. Reinstall it
renv::install("baggr")
# 3. Restart R, then test
library(baggr)
renv::install("baggr", type = "source", rebuild = TRUE)
